﻿Public Class FormValidar

    Private _miCampamento As Campeonato

    Private Sub FormValidar_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me._miCampamento = New Campeonato()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If Me.tbxUsuario.Text = "" Or Me.tbxConstraseña.Text = "" Then
            MsgBox("Los campos no pueden estar vacios")
        Else
            Me._miCampamento.validar(Me.tbxUsuario.Text, Me.tbxConstraseña.Text)
            'Me.Visible = False
        End If
    End Sub
   
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub tbxUsuario_KeyPress(ByVal sender As Object, _
               ByVal e As System.Windows.Forms.KeyPressEventArgs) _
               Handles tbxUsuario.KeyPress
        If e.KeyChar = Convert.ToChar(Keys.Return) Then
            If Me.tbxUsuario.Text = "" Or Me.tbxConstraseña.Text = "" Then
                MsgBox("Los campos no pueden estar vacios")
            Else
                Me._miCampamento.validar(Me.tbxUsuario.Text, Me.tbxConstraseña.Text)

                e.Handled = True
            End If
        End If

    End Sub

    Private Sub tbxConstraseña_KeyPress(ByVal sender As Object, _
                ByVal e As System.Windows.Forms.KeyPressEventArgs) _
                Handles tbxConstraseña.KeyPress
        If e.KeyChar = Convert.ToChar(Keys.Return) Then
            If Me.tbxUsuario.Text = "" Or Me.tbxConstraseña.Text = "" Then
                MsgBox("Los campos no pueden estar vacios")
            Else
                Me._miCampamento.validar(Me.tbxUsuario.Text, Me.tbxConstraseña.Text)
                e.Handled = True
            End If
        End If
    End Sub
End Class
